﻿@model IEnumerable<store.Category>
<div class="section category-list">
    <h4 class="section-title">DANH MỤC</h4>
    <div class="section-body">
        <ul class="unstyled pretty-list">
            @foreach (var x in Model.Where(x => x.ParentID == 0))
            {
                <li><a href="@Url.Action("Index", "Category", new { id = x.CategoryID })">@Html.DisplayFor(item => x.Name)</a>
                    <ul>
                        @foreach (var y in Model)
                        {
                            if (x.CategoryID == y.ParentID)
                            {
                                <li><a href="@Url.Action("Index", "Category", new { id = y.CategoryID })">@Html.DisplayFor(item => y.Name)</a></li>
                            }
                        }
                    </ul>
                </li>
            }
        </ul>
    </div>
</div>

